package annotation.getters;

import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import annotation.Args;
import annotation.IPropertityGetter;

import java.util.List;
import java.util.stream.Collectors;

public class SelectBoxPropertityGetter implements IPropertityGetter<List<String>, WebElement> {
    @Override
    public List<String> getPropertity(WebElement webElement, Object pageObject, Args addtionArgs) {
        return webElement.findElements(By.xpath("./parent::*/div/span"))
                .stream()
                .map(WebElement::getText)
                .collect(Collectors.toList());
    }
}
